//
//  M3U8Handle.h
//  LocalHttpServerExample
//
//  Created by Lin Eidan on 13-9-6.
//  Copyright (c) 2013年 taomee. All rights reserved.
//

#import <Foundation/Foundation.h>
@class AFHTTPRequestOperation;
@class VideoObj;

@protocol M3U8HandleDelegate;


@interface M3U8Handle : NSObject

@property(strong, nonatomic) NSString *contentId;
@property(strong, nonatomic) NSString *episodeId;
@property(strong, nonatomic) NSString *url;
@property(assign, nonatomic) int curNum;
@property(strong, nonatomic) VideoObj *VideoObj;


@property(strong, nonatomic) NSMutableArray *segmentsArray;
@property(strong, nonatomic) NSString *localM3U8FileFolder;  //所在文件夹
@property(strong, nonatomic) NSString *localHttpServerM3U8FilePath;  //连带文件名,在本地服务器地址

@property(assign, nonatomic) float totalDur;

@property(weak, nonatomic) id<M3U8HandleDelegate>delegate;

-(id)initWithDownloadObj:(VideoObj *)obj;
-(void)parseURL:(NSString *)url;

//-----------------------cartoon------------------
@property (strong, nonatomic) NSMutableArray *cartoonPicInLocalServerURLArray;
-(void)parseURLArray:(NSArray *)urlArray;

@end

@protocol M3U8HandleDelegate <NSObject>

@optional
-(void)m3U8HandleFailed:(M3U8Handle *)m3U8Handle andVideoObj:(VideoObj *)VideoObj;
-(void)m3U8HandleSuccessed:(M3U8Handle *)m3U8Handle andIsCartoon:(BOOL)isCartoon andVideoObj:(VideoObj *)VideoObj;

@end



//m3u8中每个片段的信息
@interface M3U8SegmentInfo : NSObject

@property(assign, nonatomic) float segmentLength;
@property(strong, nonatomic) NSString *segmentURL;
-(id)initWithLength:(float )length andURL:(NSString *)url;

@end
